<%
var headerPart = {
%>
<script type="text/javascript">
    $(document).ready(function() {
        $("input[name=id]").each(function(){
            var articleSelect = null;
            if (top.mainFrame.cmsMainFrame){
                articleSelect = top.mainFrame.cmsMainFrame.articleSelect;
            }else{
                articleSelect = top.mainFrame.articleSelect;
            }
            if(articleSelect){
                for (var i=0; i<articleSelect.length; i++){
                    if (articleSelect[i][0]==$(this).val()){
                        this.checked = true;
                    }
                }
			}
            $(this).click(function(){
                var id = $(this).val(), title = $(this).attr("title");
                if (top.mainFrame.cmsMainFrame){
                    top.mainFrame.cmsMainFrame.articleSelectAddOrDel(id, title);
                }else{
                    top.mainFrame.articleSelectAddOrDel(id, title);
                }
            });
        });
    });
    function view(href){
        layer.open({
            type: 2,
            title: "查看文章",
            shadeClose: true,
            shade: 0.3,
            area: ['800px','400px'],
            content: href,
            btn: ['关闭'],
            yes: function(index, layero){
                layer.close(index);
            }
        });
        return false;
    }
    function page(n,s){
        $("#pageNo").val(n);
        $("#pageSize").val(s);
        $("#searchForm").submit();
        return false;
    }
</script>
<style type="text/css">
	.layui-table-page{
		padding: 7px 0px 0px;
	}
</style>
<% }; %>
<% layout("/layouts/micro.html",{headerSection:headerPart}){ %>
<div class="childrenBody">
	<form id="searchForm" action="${ctx}/cms/article/selectList" method="post" class="layui-form">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<div class="layui-input-inline">
			<label class="layui-form-label">栏目：</label>
			<div class="layui-input-inline">
				<#treeselect id="category" name="category.id" value="${article.category.id}" labelName="category.name" labelValue="${article.category.name}"
					title="栏目" url="/cms/category/treeData" module="article" cssClass="input-small"/>
			</div>
		</div>
		<div class="layui-input-inline">
			<label class="layui-form-label">标题：</label>
			<div class="layui-input-inline">
				<input type="text" name="title"  htmlEscape="false" maxlength="50" class="layui-input"/>
			</div>
		</div>
		<div class="layui-input-inline">
              <button class="layui-btn layui-btn-sm" lay-filter="*" lay-submit>查询</button>
        </div>
	</form>
	<table id="contentTable" class="layui-table" >
		<thead>
			<tr>
				<th style="text-align:center;">选择</th>
				<th>栏目</th>
				<th>标题</th>
				<th>权重</th>
				<th>点击数</th>
				<th>发布者</th>
				<th>更新时间</th>
			</tr>
		</thead>
		<tbody>
			<%for(article in page.list){%>
			<tr>
				<td style="text-align:center;"><input type="checkbox" name="id" value="${article.id}" title="${@StringUtils.abbr(article.title,40)}" /></td>
				<td><a href="javascript:" onclick="$('#categoryId').val('${article.category.id}');$('#categoryName').val('${article.category.name}');$('#searchForm').submit();return false;">${article.category.name}</a></td>
				<td><a href="${ctx}/cms/article/form?id=${article.id}" title="${article.title}" onclick="return view(this.href);">${@StringUtils.abbr(article.title,40)}</a></td>
				<td>${article.weight}</td>
				<td>${article.hits}</td>
				<td>${article.createBy.name}</td>
				<td>${article.updateDate,dateFormat="yyyy-MM-dd HH:mm:ss"}</td>
			</tr>
			<%}%>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	</div>
<%}%>